package com.yexiao.cofe.common.exception;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author lkl
 * @since 2025/3/12
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BusinessException extends RuntimeException {

    private static final int DEFAULT_CODE = 666;

    private Integer code;

    private String msg;

    private Object data;

    public BusinessException(String msg) {
        this(DEFAULT_CODE, msg, new Object());
    }

    public BusinessException(int code, String msg) {
        this(code, msg, null);
    }

    public BusinessException(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
}
